﻿using MLSMooc.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using MLSMooc.Helper;
using Dapper;
using MLSMooc.DAO.Interface.Wechat;

namespace MLSMooc.DAO.Implement.Wechat
{
   public class WechatDAO : IWechatDAO
    {
        private static WechatDAO instance = new WechatDAO();
        private WechatDAO() { }
        public static WechatDAO Getinstance() => instance;

        private static readonly string queryField = "select * from Mooc_Wechat where isDelete=0 order by CreateTime Desc";

        public async Task<IEnumerable<WechatBO>> GetWechatList()
        {
            using (SqlConnection conn=new SqlConnection(SalesSysSqlHelper.connectionString))
            {
                StringBuilder sql = new StringBuilder(queryField);
                var res = await conn.QueryAsync<WechatBO>(sql.ToString());
                return res;
            }
        }
    }
}
